<template>
  <div class="tas-main">
    <!-- 风险源 -->
    <div class="source-class">
      <label>风险分类：</label>
      <el-radio-group v-model="source" @input="initPage">
        <el-radio-button :label="item.value" v-for="(item, index) in riskTypes" :key="index">{{
          item.label
        }}</el-radio-button>
      </el-radio-group>
    </div>

    <div class="table-container" style="margin: 0 15px">
      <!-- 治理状态tab切换 -->
      <!-- <el-button @click="dataStatusShow = true" class="question" type="text" icon="el-icon-question"></el-button> -->
      <el-tabs v-model="activeName" @tab-click="resetTableList">
        <el-tab-pane
          v-for="(item, index) in status"
          :key="index"
          :label="`${item.label}(${statusCount[item.prop]})`"
          :name="item.name"
        >
          <span slot="label">
            {{ item.label }}({{ statusCount[item.prop] }})
            <el-tooltip placement="top" trigger="hover" :content="item.intro" v-if="item.intro">
              <el-button size="medium" style="color: #999" type="text" icon="el-icon-question"> </el-button>
            </el-tooltip>
            <!-- {{ item.label }}({{ statusCount[item.prop] }}) -->
          </span>
        </el-tab-pane>
      </el-tabs>

      <sec-ext-table
        :reserveSelection="true"
        :rowKey="getRowId"
        :selection="true"
        :default-sort="sortProp"
        ref="multipleTable"
        @selection-change="handleSelectionChange"
        :tableData="tableData"
        :tableCol="tableCol"
        :filterCol="filterCol"
        @filter-confirm="filterConfirm"
        @search-change="searchChange"
        @sort-change="sortChange"
      >
        <el-button
          type="primary"
          v-if="['all', '0'].includes(activeName)"
          :disabled="isDisabledAboutPer"
          @click="handleAddGovernOwner(null)"
        >
          批量添加治理人
        </el-button>
        <el-button
          type="primary"
          v-if="
            ['0', '14'].includes(activeName) ||
            (source == 'api-api-1:fileDownload' && ['12', '14', '100', '18'].includes(activeName))
          "
          :disabled="isDisabledGovern"
          @click="handleGovernStatus(false, true)"
        >
          批量转治理
        </el-button>
        <el-button
          type="primary"
          :disabled="isDisabledNoGovern"
          v-if="isShowMulGovern('noGovernRequired')"
          @click="handleGovernStatus(false, false)"
        >
          批量无需治理
        </el-button>
        <el-button
          type="primary"
          :disabled="isDisabledWaitNoGovern"
          v-if="isShowMulGovern('noGovernRequiredForTmp')"
          @click="handleGovernStatus(false, false)"
        >
          批量暂不治理
        </el-button>
        <template v-slot:leader="{ data }">
          <dc-user v-if="data.row.leader" :name="data.row.leader"></dc-user>
          <el-button v-else type="text" @click="handleAddGovernOwner(data.row)">无</el-button>
        </template>
      </sec-ext-table>
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page.sync="page"
        background
        :layout="layout"
        :page-sizes="pageSizes"
        :page-size="pageSize"
        :total="totalSize"
      >
      </el-pagination>
    </div>
    <!-- 添加治理人 -->
    <el-dialog title="添加治理人" append-to-body :visible.sync="isAddShow" width="80%">
      <account-change
        ref="accountChangeRef"
        v-if="isAddShow"
        :datas="selRows"
        :operateType="1"
        @cancel="isAddShow = false"
        @confirm-success="addConfirmSuccess"
      ></account-change>
    </el-dialog>
    <!-- 误报 -->
    <el-dialog title="误报" append-to-body :visible.sync="falseAlarm.diaShow" width="60%">
      <sec-form
        ref="falseAlarmRef"
        :loadingProp="falseAlarm.loadingProp"
        :optionData="falseAlarm.optionData"
        :formData="falseAlarm.formData"
        :ruleForm="falseAlarm.ruleForm"
        :rules="falseAlarm.rules"
      ></sec-form>
    </el-dialog>
    <!-- 已线下处置 -->
    <el-dialog title="已线下处置" append-to-body :visible.sync="offline.diaShow" width="60%">
      <sec-form
        ref="offlineRef"
        :loadingProp="offline.loadingProp"
        :optionData="offlineOptionData"
        :formData="offlineFormData"
        :ruleForm="offline.ruleForm"
        :rules="offline.rules"
      ></sec-form>
    </el-dialog>
    <!-- 转治理/无需治理/暂不治理 -->
    <el-dialog :title="governDia.title" append-to-body :visible.sync="governDia.diaShow" width="60%">
      <el-collapse v-for="(item, index) in governDia.rows" :key="index" v-model="activeNames">
        <el-collapse-item :title="item.leader" :name="index">
          <sec-desc border :column="3" colon :data="item" :keyData="governDia.governCol"></sec-desc>
          <mul-account-change
            v-if="governDia.diaShow && governDia.title === '转治理' && activeName == '0'"
            :data="item"
          ></mul-account-change>
          <div v-if="governDia.diaShow && governDia.title !== '转治理'">
            <span>备注：</span>
            <el-input
              style="width: calc(100% - 50px); vertical-align: top"
              v-model="item.remark"
              :autosize="{ minRows: 3, maxRows: 6 }"
              type="textarea"
              placeholder="请输入备注"
            ></el-input>
          </div>
        </el-collapse-item>
      </el-collapse>
      <!-- <div v-for="(item, index) in governDia.rows" :key="index">
        <sec-desc border :column="3" colon :data="item" :keyData="governDia.governCol"></sec-desc>
        <mul-account-change v-if="governDia.diaShow && governDia.title === '转治理'" :data="item"></mul-account-change>
      </div> -->
      <div style="margin: 20px 0">
        {{
          governDia.title === "转治理"
            ? "将变更数据状态为”未治理“，并同步发送工单至治理人，是否继续？"
            : `将变更数据状态为”${governDia.title}“，是否继续？`
        }}
      </div>

      <div slot="footer" class="app-button--center">
        <el-button @click="governDia.diaShow = false">取消</el-button>
        <el-button @click="handleGovernDataConfirm" :loading="governDia.loading" type="primary">确认</el-button>
      </div>
    </el-dialog>
    <!-- 转交 -->
    <el-dialog title="转交" append-to-body width="80%" :visible.sync="isShowDeliver">
      <account-change
        ref="accountChangeRef"
        v-if="isShowDeliver"
        :datas="selRows"
        :operateType="1"
        @cancel="isShowDeliver = false"
        @confirm-success="addConfirmSuccess"
      ></account-change>
    </el-dialog>
  </div>
</template>

<script>
import { paginationMixin } from "@/mixins/pagination";
import {
  getRiskTypeApi,
  getFeModelCfgList,
  getStatusCount,
  batchAddLeaders,
  updateGovernStatus,
  getRiskListBySearchAndFilterApi,
  batchEditGovernorAndUpdateStatusApi,
} from "api/riskCenterApi";
import { changeSensitivityWorkUser } from "api/taskCenterApi";
import { configConditionApi } from "api/api";
import mulAccountChange from "./components/mulAccountChange";
import accountChange from "components/accountChange";
export default {
  name: "riskAPIManage",
  props: {},
  mixins: [paginationMixin],
  components: { mulAccountChange, accountChange },
  data() {
    return {
      isShowDeliver: false,
      sortProp: { prop: "createTime", order: "descending" }, //排序的数据
      offline: {
        ruleForm: { governType: "", remark: "" },
        diaShow: false,
        loadingProp: { confirm: false },
        rules: {
          governType: this.config.selectRule,
        },
      },
      falseAlarm: {
        diaShow: false,
        ruleForm: { misidentifyType: "", remark: "" },
        optionData: {
          misidentifyType: [
            { label: "数据源", value: 0 },
            { label: "规则（策略）", value: 1 },
            { label: "其他", value: 2 },
          ],
        },
        rules: {
          misidentifyType: this.config.selectRule,
          // remark: this.config.inputRule,
        },
        loadingProp: { confirm: false },
        formData: [
          { type: "radio", label: "误报类型", prop: "misidentifyType" },
          { type: "textarea", label: "备注", prop: "remark" },
          {
            type: "operation",
            style: "text-align:right",
            children: [
              {
                label: "取消",
                click: () => {
                  this.falseAlarm.diaShow = false;
                },
              },
              {
                label: "确定",
                prop: "confirm",
                click: () => {
                  if (this.$refs.falseAlarmRef.submitForm()) {
                    this.falseAlarm.loadingProp.confirm = true;
                    let { misidentifyType, remark } = this.falseAlarm.ruleForm;
                    updateGovernStatus({
                      ...this.getComParams(),
                      uniqueIds: [this.selRows[0].uniqueId],
                      status: "18",
                      curStatus: this.activeName === "all" ? "" : this.activeName,
                      misidentifyType,
                      remark,
                    }).then((res) => {
                      this.falseAlarm.loadingProp.confirm = false;
                      let state = this.message.state(res);
                      if (!state) return;

                      this.falseAlarm.diaShow = false;
                      this.initStatus(); //获取状态
                      this.initTableData(); //获取列表数据
                    });
                  }
                },
              },
            ],
          },
        ],
      },
      activeNames: [],
      source: "", //数据源

      //搜索框数据
      riskTypes: [], //风险类型
      //表格的数据
      status: this.$store.state.dictionary.status,
      statusCount: {},
      activeName: "",

      selRows: [],
      tableData: [],
      tableCol: [],
      filterCol: [],
      operation: {
        type: "operation",
        label: "操作",
        width: 160,
        children: [
          {
            label: "详情",
            click: ({ row }) => {
              console.log();
              this.detailClick(row);
            },
          },
          {
            label: "转交",
            disabled: ({ row }) => {
              return !row.leader;
            },
            hide: ({ row }) => {
              return !this.isShowGovern(row, "转交");
            },
            click: ({ row }) => {
              this.selRows = [row];
              this.isShowDeliver = true;
            },
          },
          {
            label: "转治理",
            disabled: ({ row }) => {
              return !row.leader;
            },
            hide: ({ row }) => {
              return !this.isShowGovern(row, "转治理");
            },
            click: ({ row }) => {
              this.governDia.title = "转治理";
              this.handleGovernStatus(row, true);
            },
          },
          {
            label: "无需治理",
            hide: ({ row }) => {
              let { riskOperateConfig } = this.statusCount;
              if (riskOperateConfig) {
                return !this.isShowBtnByConfig("noGovernRequired");
              }
              if (this.source === "bamailog-ck" && ["10"].includes(this.activeName)) {
                return false;
              }
              //operateAuto 0/1 人工转/自动转
              return !this.isShowGovern(row, "无需治理") || row.operateAuto === "1";
            },
            click: ({ row }) => {
              this.governDia.title = "无需治理";
              this.handleGovernStatus(row, false);
            },
          },
          {
            label: "暂不治理",
            hide: ({ row }) => {
              //  "riskOperateConfig":{
              //     "misReport":true, 误报
              //     "noGovernRequiredForTmp":true, 暂不治理
              //     "noGovernRequired":true 无需治理
              //   }
              let { riskOperateConfig } = this.statusCount;
              if (riskOperateConfig) {
                return !this.isShowBtnByConfig("noGovernRequiredForTmp");
              }
              return true;
            },
            click: ({ row }) => {
              this.governDia.title = "暂不治理";
              this.handleGovernStatus(row, false);
            },
          },
          {
            label: "误报",
            hide: ({ row }) => {
              //根据配置化 是否展示按钮（新的判断逻辑，由后端去配置，由于源的差异化比较大，所以直接让后端去配置）
              let { riskOperateConfig } = this.statusCount;
              if (riskOperateConfig) {
                return !this.isShowBtnByConfig("misReport");
              }
              //前端根据状态是否展示按钮（之前的判断逻辑）
              if (this.source === "api-api-1:fileDownload") return true;
              return !this.isShowMis(row) || row.operateAuto === "1";
            },
            click: ({ row }) => {
              this.selRows = [row];
              this.falseAlarm.diaShow = true;
              this.$nextTick(() => {
                this.$refs.falseAlarmRef.resetForm();
              });
            },
          },
          {
            label: "已线下处置",
            hide: ({ row }) => {
              return !(this.source === "cooper" && this.activeName === "10");
            },
            click: ({ row }) => {
              this.selRows = [row];
              this.offline.diaShow = true;
              this.$nextTick(() => {
                this.$refs.offlineRef.resetForm();
              });
            },
          },
        ],
      },
      //弹框
      isAddShow: false,
      // 治理/无需治理 弹框数据
      governDia: {
        title: "",
        diaShow: false,
        governCol: [],
        rows: [],
        loading: false,
      },
    };
  },
  computed: {
    //批量操作治理人 只有治理人是无的时候 才可以操作
    isDisabledAboutPer() {
      if (this.selRows.length == 0) return true;
      return !this.selRows.every((item) => !item?.leader);
    },
    //批量转治理
    isDisabledGovern() {
      if (this.selRows.length == 0) return true;
      if (["14"].includes(this.activeName)) return false;
      return !this.selRows.every((item) => item.operateAuto === "0" && item.leader);
    },
    // 批量无需治理
    isDisabledNoGovern() {
      if (this.selRows.length == 0) return true;
      let { riskOperateConfig } = this.statusCount;
      if (riskOperateConfig) {
        return !this.isShowBtnByConfig("noGovernRequired");
      }
      return !this.selRows.every((item) => item.operateAuto === "0");
    },
    //批量暂不治理
    isDisabledWaitNoGovern() {
      if (this.selRows.length == 0) return true;
      let { riskOperateConfig } = this.statusCount;
      if (riskOperateConfig) {
        return !this.isShowBtnByConfig("noGovernRequiredForTmp");
      }
      return !this.selRows.every((item) => item.operateAuto === "0");
    },
    type() {
      return this.$route.params.type;
    },
    isShowMulNoGovernBtn() {
      let { riskOperateConfig } = this.statusCount;
      if (riskOperateConfig) {
        return !riskOperateConfig.some((item) => item.status == this.activeName && item["noGovernRequired"]);
      }
      return true;
    },
  },
  async created() {
    this.offlineOptionData = {
      governType: [
        { label: "删除PII字段", value: 0 },
        { label: "取消公开分享", value: 1 },
        { label: "其他", value: 2 },
      ],
    };
    this.offlineFormData = [
      { type: "radio", label: "治理情况", prop: "governType" },
      { type: "textarea", label: "备注", prop: "remark" },
      {
        type: "operation",
        style: "text-align:right",
        children: [
          {
            label: "取消",
            click: () => {
              this.offline.diaShow = false;
            },
          },
          {
            label: "确定",
            prop: "confirm",
            click: () => {
              if (this.$refs.offlineRef.submitForm()) {
                this.offline.loadingProp.confirm = true;
                let { governType, remark } = this.offline.ruleForm;
                let governTypeName = this.offlineOptionData.governType.find((item) => item.value === governType)?.label;
                let uniqueId = this.selRows[0].uniqueId;
                updateGovernStatus({
                  ...this.getComParams(),
                  status: "12",
                  curStatus: "10",
                  operation: "已线下处置",
                  targetObjs: [{ governType, remark, uniqueId, governTypeName }],
                }).then((res) => {
                  this.offline.loadingProp.confirm = false;
                  let state = this.message.state(res);
                  if (!state) return;
                  this.offline.diaShow = false;
                  this.initStatus(); //获取状态
                  this.initTableData(); //获取列表数据
                });
              }
            },
          },
        ],
      },
    ];

    this.dataStatus = {
      data: {
        intro1: "安全部识别到有风险但暂未发送工单的数据。",
        intro2: "已发送工单至治理人，治理未完成的数据。",
        intro3: "已发送工单至治理人，验收通过或申诉通过（已治理）的数据。",
        intro4: "已发送工单至治理人，申诉通过（暂不治理）的数据，可手动重新发单。",
        intro5: "已发送工单至治理人，申诉通过（误报/无需治理）的数据，该数据被加白，未来不会被识别为风险。",
      },
      keyData: [
        { label: "待确认", prop: "intro1" },
        { label: "未治理", prop: "intro2" },
        { label: "已治理", prop: "intro3" },
        { label: "暂不治理", prop: "intro4" },
        { label: "无需治理", prop: "intro5" },
      ],
    };
    await this.initRiskType(); //获取风险类型分类 源

    this.initPage();
  },
  mounted() {},
  methods: {
    isDisaMulNoGovernBtn(type) {
      console.log(1111);
      let { riskOperateConfig } = this.statusCount;
      if (riskOperateConfig) {
        console.log("this.isShowBtnByConfig(type)", this.isShowBtnByConfig(type));
        return this.isShowBtnByConfig(type);
      }
    },
    isShowMulGovern(type) {
      console.log("this.statusCount", this.statusCount);
      let { riskOperateConfig } = this.statusCount;
      if (riskOperateConfig) {
        return this.isShowBtnByConfig(type);
      }
      return ["0"].includes(this.activeName);
    },
    isShowBtnByConfig(type) {
      let { riskOperateConfig } = this.statusCount;
      return riskOperateConfig.some((item) => item.status == this.activeName && item[type]);
    },
    deliverConfirmSuccess(data) {
      let processIds = this.selRows.map((item) => item.processId);
      let { account, remark, businessKeep, businessLineName } = ruleForm;
      this.$refs.accountChangeRef.openBtnLoading();
      changeSensitivityWorkUser({
        account,
        remark,
        approveFlag: "1", //审批工单时才用到
        businessKeep,
        businessLineName: businessKeep === "0" ? businessLineName : "",
        processIds,
      }).then((res) => {
        this.$refs.accountChangeRef.closeBtnLoading();
        let state = this.message.state(res);
        if (!state) return;
        this.isShowDeliver = false;
        //列表界面调用
        this.reset?.();
      });
    },
    searchChange(val) {
      this.searchVal = val;
      this.page = 1;
      this.initTableData();
    },
    filterConfirm(data) {
      this.filter = data;
      this.page = 1;
      this.initTableData();
    },
    //表格 操作列 转治理/无需治理是否展示
    isShowGovern(row, btnText) {
      if (["转治理", "转交"].includes(btnText) && this.source === "api-api-1:fileDownload") {
        if (["0", "12", "14", "100", "18"].includes(this.activeName)) return true;
      } else {
        if (this.activeName == "14") return true;
      }
      //暂不治理状态 转治理展示

      return row.operateAuto === "0" && this.activeName === "0" ? true : false;
    },
    //是否展示误报
    isShowMis(row) {
      if (["14", "10"].includes(this.activeName)) return true;
      return row.operateAuto === "0" && this.activeName === "0" ? true : false;
    },
    async initPage() {
      this.page = 1;
      this.reset();
      //初始化表格头，防止表格列顺序错乱
      this.tableCol = [];
      this.tableData = [];
      this.setStateInfo(); //在state存一份type，source
      //这是表格列表需要的接口
      await this.initStatus(); //获取状态
      this.$nextTick(() => {
        this.initConfigCondition(); //获取表格头
        this.initTableData(); //获取列表数据
      });
    },
    setStateInfo() {
      this.$store.commit("setType", this.type);
      this.$store.commit("setSource", this.source);
    },
    initConfigCondition() {
      let { type } = this.getComParams();
      if (!type) return;
      configConditionApi(this.getComParams()).then((res) => {
        console.log("[ res ] >", res);
        let data = res.data;
        let { tableCol, filterCol } = new this.ConfigCondition({
          data: data,
          exclude: ["uniqueId"],
          type: {
            slot: ["leader"],
            textarea: { props: ["httpDetail"], options: { autosize: { minRows: 2, maxRows: 6 } } },
          },
        });
        console.log("[ this.tableCol ] >", this.tableCol);

        this.tableCol = tableCol;
        this.tableCol.push(this.operation);

        this.filterCol = filterCol;
        this.$nextTick(() => {
          this.tableCol.forEach((item) => {
            console.log("[ item.comment ] >", item.comment);
          });
        });
      });
    },
    //点击重置和搜索 走这里
    searchHandle(data) {
      this.ruleForm = data;
      this.initStatus(); //获取状态
      this.resetTableList();
    },
    resetTableList() {
      this.page = 1;
      this.$nextTick(() => {
        this.$refs.multipleTable?.clearSelection(); //初始化选中表格
        this.selRows = [];
      });
      this.initTableData();
    },
    //状态切换
    getRowId(row) {
      return row.uniqueId;
    },
    handleSelectionChange(val) {
      console.log("[ val ] >", val);
      this.selRows = val;
    },
    getComParams() {
      return {
        type: this.type,
        source: this.source,
      };
    },

    async initRiskType() {
      await getRiskTypeApi({ riskType: this.getComParams().type }).then((res) => {
        let data = res.data || [];
        this.source = data[0].value;
        this.riskTypes = data;
      });
    },

    async initStatus() {
      await getStatusCount(this.getComParams()).then((res) => {
        this.statusCount = res.data;
        console.log(res);
      });
    },
    initTableData() {
      let loading = this.openLoading();
      let { prop, order } = this.sortProp;
      getRiskListBySearchAndFilterApi({
        pageNum: this.page,
        pageSize: this.pageSize,
        status: this.activeName == "all" ? "" : this.activeName,
        filter: this.filter,
        searchCnt: this.searchVal,
        orderField: prop, //排序字段
        sort: this.formatSort(order), //排序方式
        ...this.getComParams(),
      }).then((res) => {
        console.log(res);
        loading.close();
        let { count, data } = res;
        this.totalSize = count;
        this.tableData = data;
      });
    },
    formatSort(orderParams) {
      if (!orderParams) return "";
      let order = "";
      if (orderParams == "ascending") {
        order = "asc";
      } else if (orderParams == "descending") {
        order = "desc";
      }
      return order;
    },
    sortChange({ column }) {
      //如果取消排序，把字段值也赋值成空
      let prop = column.order ? column.property : "";
      this.sortProp = { prop, order: column.order };
      this.initTableData();
    },
    // 查看详情
    detailClick(row) {
      this.utils.$router(
        {
          path: `/govern/${this.getComParams().type}/${this.source}`,
          query: { uniqueId: row.uniqueId },
        },
        "_blank",
      );
    },
    // 转治理/无需治理
    handleGovernStatus(row = false, status) {
      // this.governDia.title = status ? "转治理" : "无需治理";
      this.governDia.rows = row ? [row] : this.selRows;
      this.activeNames = this.governDia.rows.map((item, index) => index);
      console.log("this.governDia.rows", this.governDia.rows);
      this.governDia.diaShow = true;

      getFeModelCfgList({ ...this.getComParams(), operateType: 1 }).then((res) => {
        let data = res.data;
        //转治理 格外添加的列 sec-desc (label/comment) (prop/property)
        let moreCol = [
          { label: "业务线", prop: "businessLineName" },
          { label: "一级部门", prop: "dept0" },
          { label: "二级部门", prop: "dept1" },
          { label: "三级部门", prop: "dept2" },
        ];
        this.governDia.governCol = this.governDia.title == "转治理" ? [...data, ...moreCol] : data;
      });
    },
    // 转治理 /无需治理 确定
    handleGovernDataConfirm() {
      console.log(this.governDia.rows);

      this.governDia.loading = true;
      if (this.governDia.title === "转治理") {
        this.governHandle(); //转治理的处理
      } else {
        //暂不治理,无需治理的处理
        this.noGovernHandle();
      }
    },
    //治理和不治理 操作后的回调
    governAfterInit(res) {
      this.governDia.loading = false;
      let state = this.message.state(res);
      if (!state) return;

      // this.initPage();
      this.governDia.diaShow = false;
      this.initStatus(); //获取状态
      this.initTableData(); //获取列表数据

      this.$refs.multipleTable?.clearSelection();
    },
    governHandle() {
      let riskGovernorList = this.governDia.rows.map((item) => {
        return {
          uniqueId: item.uniqueId,
          account: item.account,
          remark: item.remark,
          businessLineName: item.businessLine,
          businessKeep: item.businessKeep,
        };
      });
      batchEditGovernorAndUpdateStatusApi({
        riskGovernorList,
        status: this.governDia.title === "转治理" ? "10" : "100",
        curStatus: this.activeName === "all" ? "" : this.activeName,
        ...this.getComParams(),
      }).then((res) => {
        this.governAfterInit(res);
      });
    },
    noGovernHandle() {
      let uniqueIds = this.governDia.rows.map((item) => item.uniqueId);
      // console.log("[  uniqueIds] >", uniqueIds);
      //无需治理  后端通过targetObjs 获取uniqueId和备注内容。
      let statusTitleEnum = {
        转治理: "10",
        无需治理: "100",
        暂不治理: "14",
      };
      let targetObjs = ["无需治理", "暂不治理"].includes(this.governDia.title)
        ? this.governDia.rows.map((item) => ({ uniqueId: item.uniqueId, remark: item.remark }))
        : [];
      const params = {
        uniqueIds,
        status: statusTitleEnum[this.governDia.title],
        curStatus: this.activeName === "all" ? "" : this.activeName,
        ...this.getComParams(),
        targetObjs,
      };
      updateGovernStatus(params).then((res) => {
        this.governAfterInit(res);
      });
    },
    // 添加治理人
    handleAddGovernOwner(row) {
      this.selRows = row ? [row] : this.selRows;
      this.isAddShow = true;
    },

    addConfirmSuccess(ruleForm) {
      let riskDataIds = this.selRows.map((item) => item.uniqueId);
      let { account, remark, businessKeep, businessLineName } = ruleForm;
      this.$refs.accountChangeRef.openBtnLoading();
      batchAddLeaders({
        leader: account,
        remark,
        businessKeep,
        businessLineName: businessKeep === "0" ? businessLineName : "",
        riskDataIds,
        ...this.getComParams(),
      }).then((res) => {
        this.$refs.accountChangeRef.closeBtnLoading();
        let state = this.message.state(res);
        if (!state) return;
        this.isAddShow = false;
        this.isShowDeliver = false;
        this.initStatus();
        this.initTableData(); //获取列表数据
        this.reset();
      });
    },

    reset() {
      this.selRows = [];
      this.$refs.multipleTable?.clearSelection(); //初始化选中表格
      this.searchVal = "";
      this.filter = [];
      this.$refs.multipleTable?.reset(); //初始化选择框和筛选项以及字段设置
    },
    // 页码变更
    handleCurrentChange(val) {
      this.page = val;
      this.initTableData();
    },
    // 条数变更
    handleSizeChange(val) {
      this.pageSize = val;
      this.initTableData();
    },
  },
  watch: {
    "falseAlarm.ruleForm.misidentifyType": {
      deep: true,
      immediate: true,
      handler(newVal) {
        console.log(newVal);
        if (newVal == 2) {
          this.$set(this.falseAlarm.rules, "remark", this.config.inputRule);
        } else {
          this.$set(this.falseAlarm.rules, "remark", {});
        }
      },
    },
    "offline.ruleForm.governType": {
      deep: true,
      immediate: true,
      handler(newVal) {
        if (newVal == 2) {
          this.$set(this.offline.rules, "remark", this.config.inputRule);
        } else {
          this.$set(this.offline.rules, "remark", {});
        }
      },
    },
  },
};
</script>
<style lang="scss" scoped>
//@import url(); 引入公共css类
.table-container {
  .btn {
    position: absolute;
    z-index: 1;
    right: 20px;
  }
}
.table-container {
  position: relative;
  .question {
    position: absolute;
    // left: 700px;
    left: -20px;
    font-size: 14px;
    // right: 0;
    top: 3px;
    color: rgb(51, 51, 51);
    // cursor: pointer;
    z-index: 100;
  }
}
</style>
